import 'package:flutter/material.dart';

class IconSection extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Row(
      mainAxisAlignment: MainAxisAlignment.spaceEvenly,
      children: <Widget>[
        _IconLabel(icon: Icons.call, text: 'CALL'),
        _IconLabel(icon: Icons.near_me, text: 'ROUTE'),
        _IconLabel(icon: Icons.share, text: 'SHARE'),
      ],
    );
  }
}

class _IconLabel extends StatelessWidget {
  // 类的重写， 是无参变有参
  _IconLabel({Key key, @required this.icon, @required this.text}) : super(key: key);
  final IconData icon;
  final String text;

  @override
  Widget build(BuildContext context) {
    return Column(
      children: <Widget>[
        Container(
          margin: EdgeInsets.only(bottom: 8),
          child: Icon(icon, color: Colors.blue),
        ),
        Text(
          "$text",
          style: TextStyle(fontSize: 12, color: Colors.blue),
        ),
      ],
    );
  }
}
